package com.ruoyi.web.controller.example;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.res_banner.domain.Res_Banner;
import com.ruoyi.res_banner.service.Res_BannerService;
import com.ruoyi.student.domain.Student;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@Anonymous
@RestController
@Api(tags = "轮播图管理")

public class Res_BannerController {

        @Autowired
        private Res_BannerService service;
        @ApiOperation(value = "获取所有轮播图列表")
        @RequestMapping("/GetRes_BannerAll")
        public AjaxResult GetRes_BannerAll(){
            List<Res_Banner> result = service.getRes_BannerList();
            return AjaxResult.success(result);
        }
        @ApiOperation(value = "新增一条信息")
        @PostMapping("/addRes_Banner")
        public AjaxResult addRes_Banner(@RequestBody Res_Banner res_banner){
            int result = service.addRes_Banner(res_banner);
            return AjaxResult.success(result);
        }
    @ApiOperation("修改一条消息")
    @PostMapping("/updateRes_Banner")
    public AjaxResult updateRes_Banner( @RequestBody Res_Banner res_banner){
        service.updateRes_Banner(res_banner);
        return AjaxResult.success();
    }
    @ApiOperation("删除信息")
    @GetMapping("/deleteRes_Banner")
    public AjaxResult deleteRes_Banner( int id){
        service.deleteRes_Banner(id);
        return AjaxResult.success();
    }
    @ApiOperation("根据标题查询信息")
//    比较复杂的查询用post，通常用get
    @PostMapping("/queryRes_BannerByTitle")
    public AjaxResult queryRes_BannerByTitle(String title){
        return AjaxResult.success(service.queryRes_BannerByTitle(title));
    }
}
